var kill = function(doc) {
        var i, node, els, el;

        if (!doc || !doc.getElementsByTagName) return;

        els = doc.getElementsByTagName('*');
        for (i = 0; i < els.length; ++i) {
                el = els[i];
                node = el.nodeName;
                if ('IFRAME' === node || 'FRAME' === node)
                        /* child frames */
                        kill(el.contentDocument);
                else if ('IMG' === node || (('OBJECT' === node || 'EMBED' === node) && /shockwave\-flash/.test(el.type)))
                        /* images or flash objects */
                        try {
                                el.parentNode.removeChild(el);
                        } catch (e) {
                                console.error(e.stack);
                        }
                /* background images */
                if ('none' !== getComputedStyle(el).getPropertyValue('background-image'))
                        el.style.backgroundImage = 'none';
        }
}

kill(document);